package com.simple.demo.t0602;

import java.util.*;

public class T0602 {

    public static void main(String[] args) {
//        List<Integer> list = Arrays.asList(1,2,3,4,5,6);
//        ListIterator<Integer> tor = list.listIterator();
//        while(tor.hasNext()){
//            System.out.println("当前值="+tor.next());
//            System.out.println("前一个值="+tor.previous());
//            tor.next();
//        }

        LinkedList<Integer> linkedList = new LinkedList<>();
        linkedList.add(1);
        linkedList.add(2);
        linkedList.add(3);
        linkedList.add(4);
        linkedList.add(5);
        System.out.println(linkedList.get(0));
        System.out.println(linkedList.peek());
        System.out.println(linkedList.peekFirst());
        System.out.println(linkedList.peekLast());
        System.out.println(linkedList.poll());
        System.out.println(linkedList.pollFirst());
        System.out.println(linkedList.pollLast());
        System.out.println(linkedList.size());



    }

}
